import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useBaseStore = defineStore('base', () => {
  const searchList = ref<string[]>([])
  function addSearchItem(str:string){
    searchList.value.unshift(str);
    if(searchList.value.length>9){
      searchList.value.length=9
    }
  }
  function clearSearch(){
    searchList.value = [];
  }
  return {
    searchList,addSearchItem,clearSearch
  }
}, {
  unistorage: true, // 是否持久化
})
